home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1 Issue 2 / PDCD-1 - Issue 02.iso / _editors / editors / _zap / !Zap / 3rdParty / Ebourne / ZapMJEHelp < prev   
Text File  |  1994-10-19  |  21KB  |  521 lines

  1. ZapMJE 0.60 help file
  2. ⌐ Martin Ebourne, 1994
  3.  
  4.                               -=-=-=-=-=-=-=-
  5. This software is COPYRIGHT, but has been released as FREEWARE. Please see the
  6. end of this file for conditions of use and distribution.
  7.                               -=-=-=-=-=-=-=-
  8.  
  9.  
  10. Introduction
  11. ============
  12.  
  13. ZapMJE provides several new modes and various other extensions for the Zap
  14. text editor. In brief, these are:
  15.  
  16.   Å C, Acorn Assembler and Pascal source editing modes
  17.   Å Colour, compilation, indenting, bracket matching, function browsers,
  18.     next/last function, swap to header, auto header file generation, improved
  19.     shift-left and right arrow (previous and next word), auto mode detection,
  20.     ensuring linefeed termination, and various commenting features for the
  21.     new modes (not all features in all modes)
  22.   Å Support for using StrongHelp directly
  23.   Å A command to enable keys to have different bindings for different modes
  24.   Å A command to alter the current selection (the same as Edit's F6)
  25.  
  26. Please note that ZapMJE requires Zap version 1.08 or greater to work.
  27.  
  28.  
  29. Mode specific features
  30. ==== ======== ========
  31.  
  32. Colour
  33. ------
  34.  
  35. This is currently available in the C and assembler modes. Pascal will be
  36. implemented one day (when someone has told me or I have figured out the
  37. precise syntax). For C, the colours are as follows:
  38.  
  39.   Foreground  : Used for anything which doesn't classify below
  40.   Comments    : Anything in /* */
  41.   Strings     : Strings, character constants and include filenames
  42.                 (ie. anything in "", '' or, after a #include, <>)
  43.   Instructions: Reserved words (eg. switch, void)
  44.   Preprocessor: Anything on preprocessor lines not under any other category
  45.                 (including preprocessor keywords such as #define)
  46.   Functions   : Function name in definitions, calls and macros. Not however,
  47.                 when used as a pointer
  48.   Variables   : Any other user defined word, including parameter-less macros
  49.   Numbers     : Things like 6.5!
  50.  
  51. The assembler colours are:
  52.  
  53.   Foreground  : Used for anything which doesn't classify below
  54.   Comments    : Anything after ;
  55.   Strings     : Strings and character constants (ie. anything in "" or '')
  56.   Instructions: Anything in the instruction field (first section of line
  57.                 following whitespace), plus anything else which is part of
  58.                 the instruction (eg. {, }, !). Also instruction shifts
  59.                 (eg. ASL)
  60.   Operators   : Assembler expression operators (eg. :SHL:)
  61.   Labels      : Anything in the label field (text at very start of line)
  62.   Names       : Any user defined words in the parameters of an instruction
  63.   Numbers     : Things like 2_1101
  64.  
  65. Colouring is automatic, and if you want to switch it off you will have to set
  66. all the foreground colours the same. A problem you are bound to have in 16
  67. colour modes is finding enough useable colours to display. In C they are best
  68. as all different (in assembler some of them are very closely related and
  69. hence are best coloured the same), but unfortunately there are only 5 usable
  70. colours in the normal Wimp palette. Hence the defaults include some grey
  71. ones. If using 16 colour modes, I recommend you re-define the colours in the
  72. palette to include some useable ones. Either way, you will have to redefine
  73. the colours Zap uses to what you want.
  74.  
  75. Please note that the colouring is defined to colour CORRECT source code
  76. correctly. What it does with incorrect source is arbitrary since then even
  77. the compiler/assembler will not accept it and it is hence not source code.
  78.  
  79.  
  80. Compilation
  81. -----------
  82.  
  83. This is quite powerful and is designed to cater for most situations. The way
  84. it operates is as follows (in order):
  85.  
  86. 1. Look for sourcefile.^.^.MakeFile (standard name and location for a
  87. makefile)
  88.  
  89. 2. If it is type Text (FFF) or Makefile (FE1) then pass it round as a message
  90. Data Open for either Make or AMU to pick up on. Note that it is passed round
  91. as type FE1 regardless of whether it is Text or not. This is because a lot of
  92. makefiles are typed to Text, and Make and AMU will not pick these up (but Zap
  93. will!). Also note that for AMU to intercept this message, it needs a
  94. 'filetype &FE1;' line inserted into the top section of the description file.
  95.  
  96. 3. If no task claims the message then amu is invoked from the command line in
  97. a task window. The default amu options used are '-desktop -k'. The taskwindow
  98. options used are '-display -quit'.
  99.  
  100. 4. If sourcefile.^.^.MakeFile file is not of type Text or Makefile, then it
  101. is run using Wimp_StartTask. This allows for obey files and the like to be
  102. used, giving absolute flexibility.
  103.  
  104. 5. If sourcefile.^.^.MakeFile file does not exist, then the source file is
  105. compiled/assembled direct. It cannot be passed round as a Wimp message
  106. because it is text, and so cannot be claimed by CC or whatever. Thus it is
  107. compiled/assembled in a task window along the same lines as amu if invoked
  108. above. The options used depend on the mode and are as follows:
  109.  
  110.   C      - '-IC: -throwback -LC:o.RISC_OSlib,C:o.stubs -Desktop ^'
  111.   Asm    - Assembly does not work at the moment. Makefiles are still ok
  112.            though
  113.   Pascal - '-ranprv -LC:o.Stubs -throwback -desktop ^'
  114.  
  115. 6. There is one last feature to ensure 100% flexibility. If the characters
  116. '/*+á', ';+á' or '(*+á' (depending on mode) are found within the first 1k of
  117. the source file when invoking amu or compilation/assembly directly in a task
  118. window, then the following characters until the next close comment or end
  119. of line are used INSTEAD of the default options string. This means that if
  120. you don't like the default options, you can supply your own. (For instance,
  121. if you include extra libraries or want debug code generated.)
  122.  
  123. Note that the maximum length for the command issued is 255 characters,
  124. including the filename, commands and the various options. Also, NO
  125. translation is carried out in copying the options. However, when calling
  126. *TaskWindow, the command is placed in quotes - so if any were required in the
  127. options string they would have to be doubled up originally.
  128.  
  129.  
  130. There are two commands to invoke compilation; COMPILE which saves and then
  131. compiles (assuming the save was ok), and RUN which compiles without saving
  132. the current file. (These correspond to the equivalent BASIC commands.)
  133.  
  134.  
  135. Indenting
  136. ---------
  137.  
  138. This is currently only present in the C mode, and simply puts the requested
  139. number of extra spaces onto the indent for the line following a {, and
  140. aligns }s up with the corresponding {. The indent is set via the C mode
  141. menu, and should have the value 0 to disable the feature.
  142.  
  143.  
  144. Bracket matching
  145. ------- --------
  146.  
  147. Currently only the 'as you type' matching is implemented and then only in the
  148. C mode. When you type a close bracket (either ), } or ]) the cursor will jump
  149. to the corresponding open bracket for the time specified in the pause entry
  150. in the C mode menu (in centiseconds). The pause will be truncated if you
  151. carry on typing. To disable it set the pause to 0 centiseconds.
  152.  
  153.  
  154. Function browsers
  155. -------- --------
  156.  
  157. This feature works on all three modes, and simply provides a browser of all
  158. the function definitions in the source file. C mode correctly copes with old
  159. and new style function definitions, as well as contrived statements such as:
  160.  
  161. #ifdef __STDC__
  162. int wibble(int wobble)
  163. #else
  164. int wibble(wobble)
  165. int wobble;
  166. #endif
  167. {
  168.   ...
  169.  
  170. which are designed to work under both pcc and ANSI compilers. Assembler mode
  171. simply lists all the lines on which labels are defined. This feature is
  172. invoked with the standard command LISTFNS.
  173.  
  174.  
  175. Next/last function
  176. ---- ---- --------
  177.  
  178. These work in the same way as the function browser, but place the cursor at
  179. the definition of the next or previous function in the source file. They are
  180. invoked with MJE_NEXTFUNC and MJE_LASTFUNC respectively.
  181.  
  182.  
  183. Swap to header
  184. ---- -- ------
  185.  
  186. This moves the input focus onto the corresponding header/source file (ie.
  187. with the same leafname) for the current source/header file (assuming one
  188. exists). It also loads the file if necessary. The corresponding header file
  189. is of the form sourcefile.^.^.h.sourcefile, and the corresponding sourcefile
  190. is of the form headerfile.^.^.x.headerfile where x is c, s or p depending on
  191. mode. This feature is invoked with MJE_SWAPTOHEADER.
  192.  
  193.  
  194. Auto header file generation
  195. ---- ------ ---- ----------
  196.  
  197. This is only in its simple stages at the moment, but on executing
  198. MJE_GENERATEHEADER (C mode only), function prototypes will automatically be
  199. generated and appended to the respective header file (see MJE_SWAPTOHEADER).
  200. The prototypes are appended immediately after the first occurrence of the
  201. sequence '/* Auto */', deleting everything following it. If the sequence is
  202. not found in the file, then it will be appended along with the prototypes.
  203.  
  204. Currently this only deals with functions, but variables will be included at a
  205. later date. Note also that if the header file does not exist, one will NOT be
  206. created. This is done deliberately so that you can't accidentally generate
  207. unwanted header files.
  208.  
  209.  
  210. Previous and next word
  211. -------- --- ---- ----
  212.  
  213. The previous and next word commands (shift-left & shift-right) of Zap are
  214. intended for use when text editing, and as such only stop after whitespace or
  215. parentheses. This is fine for text, but totally unsuitable for program
  216. editing unless you are liberal with your spaces (I'm not). For instance,
  217. previous/next word would jump right over 'whatever=this+that/something_else;'
  218. which is not very useful. For that reason all three of the extra modes have a
  219. much more powerful implementation as standard. It can be thought of as
  220. working like this:
  221.  
  222. There are 5 categories of character, classified in descending order as:
  223.  
  224.   5: Newline character
  225.   4: Letters and numbers
  226.   3: Anything else non-whitespace (ie. symbols)
  227.   2: Whitespace (space and tab)
  228.   1: Newline character
  229.  
  230. When you press shift-left or shift-right, the cursor will be moved in that
  231. direction until the classification of the next character (in the direction it
  232. is moving) is greater than that of the current character, upon which it will
  233. stop. Newline appears twice in order to ensure that the cursor will always
  234. stop on each side of it. (ie. at start & end of line).
  235.  
  236. This probably sounds quite complicated, but it is in actual fact very easy,
  237. and very intuitive to use. As an example, these are the points that the
  238. cursor would stop at:
  239.  
  240. Line:  if((char2=getchar())!=0 && char2!=line_terminator)
  241. Fwd :  ^   ^     ^           ^ ^  ^      ^    ^          ^
  242. Back:^   ^      ^       ^     ^  ^     ^     ^          ^
  243.  
  244.  
  245. Auto mode detection
  246. ---- ---- ---------
  247.  
  248. This is hopefully only temporary, and is provided so that header files are
  249. loaded into the correct mode. Currently Zap can only detect mode on filetype
  250. and file name. However, header files have type text and are in a h directory,
  251. but they can be any of the three modes. Thus if header files are set to C,
  252. then on loading if an assembler or Pascal comment is found as the first
  253. non-whitespace character in the file, the appropriate mode will be used
  254. instead.
  255.  
  256.  
  257. Linefeed termination
  258. -------- -----------
  259.  
  260. This quite simply ensures that there is a linefeed at the end of your file
  261. whenever you save it, in order to prevent the compiler from throwing an error
  262. and you having to re-compile for something so simple. It is functional in all
  263. three modes.
  264.  
  265.  
  266. Various commenting features
  267. ------- ---------- --------
  268.  
  269. These all work in all three modes and are:
  270.  
  271. MJE_OPENCOMMENT
  272.   This inserts the appropriate open comment text (ie. '/*á', ';á' or '(*á').
  273.  
  274. MJE_CLOSECOMMENT
  275.   Inserts appropriate close comment ('á*/' or 'á*)' [none for assembler]).
  276.  
  277. MJE_IF
  278.   Inserts 'pre-processor comment'. ie. uses conditional compilation/assembly
  279. to effectively comment out the stuff ahead.. (Handy if there are comments
  280. around, since you can't nest them in C). Inserts '#ifá0\n' or 'á[ 1=0\n'
  281. depending on mode.
  282.  
  283. MJE_ENDIF
  284.   Finishes 'pre-processor comment'. (ie. inserts '#endif\n' or 'á]\n'.)
  285.  
  286. MJE_COMMENTLINE
  287.   Comments out line and moves onto next. (ie. inserts '/*á' & 'á*/', ';á', or
  288. '(*á' & 'á*)' at start and end of line.)
  289.  
  290. MJE_UNCOMMENTLINE
  291.   Reverses above. (ie. removes '/*á' & 'á*/', ';á' or '(*á' & 'á*)' if
  292. present and moves onto next line)
  293.  
  294.  
  295. Non-standard option
  296. --- -------- ------
  297.  
  298. This will not be very useful to many people, except if they lay their
  299. assembler source out the same way as I do. Basically, if enabled then on
  300. pressing tab you will be advanced to the next 'source column' rather than tab
  301. stop. It only works sensibly with Unix or column tab, and the 'source
  302. columns' are laid out as follows (using Unix tab):
  303.  
  304. Label ->------->Ins --->Operands ------>------->------->Comment
  305.  
  306. (ie. 2, 1 and 4 tab stops)
  307.  
  308. If your source looks like that, then try it, you might like it. If it doesn't
  309. then don't switch it on and no harm done. The only reason it is in there is
  310. because it is easier than disabling it for release. Also, Dominic wanted me
  311. to use the non-standard option in order to justify its existence. I bet he'll
  312. remove it now just to spite me. ;-) This feature is probably only a stop-gap
  313. until Zap supports variable tab stops properly.
  314.  
  315.  
  316. Help commands
  317. ==== ========
  318.  
  319. These work in all modes (except tokenised BASIC at the moment).
  320. Together, they provide a more comprehensive interface to StrongHelp than
  321. StrongEd does. :-)
  322.  
  323.  
  324. Context sensitive
  325. ------- ---------
  326.  
  327. This provides help on whatever is by the cursor. Currently it only works if
  328. the cursor is on text of some description, but it is subject to improvement
  329. when I have time. It is invoked with the command MJE_HELPCONTEXT.
  330.  
  331.  
  332. Previous
  333. --------
  334.  
  335. This doesn't work at the moment, though it will do one day. MJE_HELPLAST is
  336. the command, and it will re-produce the last x previous help screens going
  337. back up a stack. (This is more for the native system.)
  338.  
  339.  
  340. Topic/keyword
  341. ----- -------
  342.  
  343. This has 3 modes of operation:
  344.  
  345. The command MJE_HELPTOPIC "text" will look for help on the keyword text. This
  346. is handy to have keys for a main menu, etc.
  347.  
  348. The command MJE_HELPTOPIC with no parameter will search for help on whatever
  349. is selected, assuming it is in the current window and not too long. (This
  350. allows help on words with symbols in, which MJE_HELPCONTEXT would discard as
  351. irrelevant.)
  352.  
  353. If it still hasn't worked out what to search for, a minibuffer will be opened
  354. for you to type in the appropriate topic.
  355.  
  356.  
  357. General features
  358. ======= ========
  359.  
  360. MJE_IFMODE
  361. ----------
  362.  
  363. This enables you to use keys for different functions in different modes, or
  364. more normally, provide the same function in several modes where one or more
  365. of them doesn't check the mode before performing the function. eg. A mapping
  366. for next function could be:
  367.  
  368. MJE_NEXTFUNC:MJE_IFMODE "7:C_NEXT_FUNCTION"
  369.  
  370. This is needed because the C_NEXT_FUNCTION command executes regardless of
  371. mode and would thus mess things up in any of the other modes.
  372.  
  373. The syntax is:
  374.  
  375. MJE_IFMODE "Modelist:Commands"
  376.  
  377. Modelist is a comma separated list of mode numbers for which the commands are
  378. to execute in. You can also use a hyphen for ranges. eg. "1,3-5,7:..." No
  379. other characters, not even spaces are allowed before the colon, apart from
  380. the option of a ! immediately before it. This has the effect of negating
  381. the condition. eg. "0,2,6,8-255!:" is the same as the previous example.
  382.  
  383. Commands is a list of commands in the normal way.
  384.  
  385.  
  386. MJE_ALTERSEL
  387. ------------
  388.  
  389. This works in the same way as Edit's F6. If there is no selection the
  390. character after the cursor is selected, else the operation is equivalent to
  391. clicking adjust with the mouse. This is very handy if you select something
  392. with the keyboard but get it slightly wrong - it saves you re-selecting the
  393. whole lot. Another essential use is to select a line/several lines with the
  394. following command sequence:
  395.  
  396. CLEFT:MJE_ALTERSEL:CRIGHT:DOWN:CLEFT:MJE_ALTERSEL
  397.  
  398. Handy hint for people who like the PC method of selection - ie. holding down
  399. shift and pressing the cursor keys. If you re-bind the shift-cursor keys as
  400. follows, then Zap should behave in the same manner:
  401.  
  402. sLEFT        &19C    LEFT:MJE_ALTERSEL
  403. sRIGHT        &19D    MJE_ALTERSEL:RIGHT:MJE_ALTERSEL
  404. sDOWN        &19E    MJE_ALTERSEL:DOWN:MJE_ALTERSEL
  405. sUP        &19F    MJE_ALTERSEL:UP:MJE_ALTERSEL
  406.  
  407.  
  408. Copyright
  409. =========
  410.  
  411. The conditions of copying this program and its associated documentation are
  412. the same as those of the main Zap application, except you do not need my
  413. permission to copy it if you have Dominic's.
  414.  
  415. This software is provided as is with no warranty as to its suitability or
  416. otherwise for any particular task. If it does anything nasty then I want to
  417. know so I can fix it, but I'm not taking any responsibility. (Besides,
  418. there's no point in sueing me since I've got no money.)
  419.  
  420. Non-release versions of this module (identify themselves as test versions on
  421. *Help ZapMJE) are *NOT* distributable without my express permission. They are
  422. also more likely to fall over. ;-) [Note that such versions have various bits
  423. of debugging code included, and will not work on RISC OS 2 due to the use of
  424. pipes for debugging. They might also do other strange (intended) things.]
  425.  
  426. Please note that I reserve the right to make alterations to this program, its
  427. operation, documentation, and/or conditions of use without notice in any way
  428. I see fit. Hopefully it will be an improvement.
  429.  
  430.  
  431. Acknowledgements
  432. ================
  433.  
  434. Thanks to Dominic for writing Zap and not even charging for it! (Though he's
  435. partly responsible for a rather large amount of damage to my 'phone bill.
  436. :-()
  437.  
  438. Thanks to Brian Scattergood for writing his Cmode which this originally came
  439. from - it made initial development a lot easier (although I did have to hack
  440. it first :-]). There's even some original (slightly modified) code left!
  441. (Most of the stuff which is C mode only.) This will have to be replaced in
  442. the course of making it work on all modes sooner or later. :-(
  443.  
  444. Thanks to Mercury for not charging quite as much as BT. (It means I'm just
  445. broke rather than completely bankrupt. :-]  Correction: It means it took me
  446. very slightly longer to become completely bankrupt.)
  447.  
  448.  
  449. Contacting
  450. ==========
  451.  
  452. I can be contacted through email to mje@soton.ac.uk all year round (faster
  453. response time during term). Alternatively, snail to:
  454.  
  455. Martin Ebourne,
  456. 1 Malvern Road
  457. Acocks Green
  458. Birmingham
  459. B27 6EG
  460.  
  461. I can also be contacted on Arcade, though only through private messages since
  462. I hardly ever read the public ones. (It's bad enough trying to keep up with
  463. Usenet/NetNews, and that's free!) A much faster response by modem can be
  464. obtained by calling Challenger on 021 445 3913 [user #3]. 24hr; V21, V22,
  465. V22bis, V23, V32, V32bis, with MNP1-5, V42 or V42bis; 7E1. Oh, and it's
  466. Viewdata. :-)
  467.  
  468. Please let me know of any bugs or undocumented features if you ever find any
  469. (and they aren't listed at the end of the file - that's the hard bit!). Also,
  470. ideas for improvement are welcome. A few of my current ideas are:
  471.  
  472.   Å Completely re-written and vastly superior indenting code
  473.   Å A really cool native help system of which the details are secret at the
  474.     moment... ;-) If you've got any ideas for it however, then now's the time
  475.     to let me have them
  476.   Å A pretty nifty selection mechanism for C & Pascal (possibly even
  477.     assembler)
  478.   Å Colour redraw for Pascal
  479.   Å Bracket matching correctly on all modes
  480.   Å Remove any features which aren't listed in this help file
  481.  
  482. If anybody wants to help me pay off some of the 'phone bill this module has
  483. incurred, then all donations are gratefully accepted at the address above.
  484. (Well you can't blame me for trying, can you!)
  485.  
  486.  
  487. Known mis-features
  488. ===== === ========
  489.  
  490. (These are just the important ones :-()
  491.  
  492. Assembler:
  493.  
  494.   Å Assembling with no make file doesn't work
  495.   Å Function finding cheats (uses search)
  496.  
  497. C:
  498.  
  499.   Å Auto header generation is very basic (yes, it's intentional!)
  500.   Å The syntax colouring is slow with large files and multiple views of the
  501.     same file, but then when constructs such as:
  502.     #inc\
  503.     lude /* *\
  504.     / <std\
  505.     io.h>
  506.     are valid (try it, it works!), it's hardly surprising. However, this will
  507.     be improved in later versions.
  508.   Å Problems with function finding:
  509.     1) Preprocessor # not at start of line not recognised
  510.     2) foo () isn't found
  511.     3) It doesn't cope with \ outside of preprocessor
  512.     These 'bugs' are due to me not knowing precisely how the C syntax worked
  513.     when I wrote it. Unfortunately, the deadline has been very tight & it's
  514.     been close to get the colouring work, let alone the function finding
  515.   Å There are a multitude of bugs in the colouring, but I bet you won't find
  516.     many! :-)
  517.  
  518. Pascal:
  519.  
  520.   Å Function finding cheats (like assembler)
  521.